package acp

import (
	"barge/pkg/util"
	"github.com/rs/zerolog/log"
)

type ConfigMap struct {
	Data map[string]string `json:"data"`
}

type Secret struct {
	Data map[string]string `json:"data"`
}

func (s *Secret) GetByKey(key string) string {
	value := s.Data[key]
	if value == "" {
		return ""
	}
	raw, err := util.DecodeBase64(value)
	if err != nil {
		log.Err(err).Send()
		return ""
	}
	return raw
}

type ClusterView struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type ClusterViewList struct {
	Items []ClusterView `json:"items"`
}
